package cn.by.wms.entity;

import java.time.LocalDateTime;

import cn.by.wms.TypeHandler.JsonTypeHandler;
import cn.by.wms.enums.WarehouseStatus;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.List;

/**
 * 库房;
 * @author : heimi
 * @date : 2024-11-22
 */
@Data
@TableName(value = "206_warehouse",autoResultMap = true)
public class Warehouse extends BaseEntity {
    @TableId(type = IdType.AUTO)
    /** 库房Id */
    private Integer id ;
    /** 库房名称 */
    private String name ;
    /** 库房图片 */
    @TableField(typeHandler = JsonTypeHandler.class)
    private List<String> img ;
    /** 库房状态 */
    private Integer status=1 ;

    @TableField(exist = false)
    private Integer statusX;
    /** 库房备注 */
    private String brief ;
    /** 库房排序 */
    private Integer seq ;

    public Integer getStatusX() {
        WarehouseStatus productStatus = WarehouseStatus.getProductStatusByCode(this.status);
        if (productStatus !=null){
            return productStatus.getCode();
        }
        return statusX;
    }
}